package com.ttn.student.controller;

import com.ttn.common.core.entity.Result;
import com.ttn.common.core.entity.studentrecord.bo.SaveBatchOralConversationStudyRecordDetailsBO;
import com.ttn.common.core.entity.studentrecord.query.QueryStudyLeaderboardQuery;
import com.ttn.common.core.entity.studentrecord.query.TestStudyRecordQuery;
import com.ttn.student.service.OralConversationStudyRecordDetailsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * (oral_conversation_study_record_details)表控制层
 *
 * @author xxxxx
 */
@RestController
@Slf4j
@RequestMapping("/oral-conversation-study-record-details")
public class OralConversationStudyRecordDetailsController {
    /**
     * 服务对象
     */
    @Resource
    private OralConversationStudyRecordDetailsService oralConversationStudyRecordDetailsService;

    @PostMapping("/save/oral-conversation-study-record-details")
    public Result saveOralConversationStudyRecordDetails(HttpServletRequest request, @RequestBody SaveBatchOralConversationStudyRecordDetailsBO saveBatchOralConversationStudyRecordDetailsBO) {
        log.info("OralConversationStudyRecordDetailsController saveOralConversationStudyRecordDetails ,参数:{}", saveBatchOralConversationStudyRecordDetailsBO);

        return oralConversationStudyRecordDetailsService.saveOralConversationStudyRecordDetails(saveBatchOralConversationStudyRecordDetailsBO);
    }

    /**
     * @param request
     * @param queryStudyLeaderboardQuery
     * @return
     */

    @PostMapping("/query/oral-conversation-study-leader-board")
    public Result queryOralConversationLeaderboard(HttpServletRequest request,
                                                   @RequestBody QueryStudyLeaderboardQuery queryStudyLeaderboardQuery) {
        log.info("OralConversationStudyRecordDetailsController queryOralConversationLeaderboard ,参数:{}", queryStudyLeaderboardQuery);
        return oralConversationStudyRecordDetailsService.queryOralConversationLeaderboard(queryStudyLeaderboardQuery);
    }

    /**
     * 查询测试记录
     *
     * @param request
     * @param testStudyRecordQuery
     * @return
     */
    @PostMapping("/query/oral-conversation-study-record-details")
    public Result queryOralConversationStudyRecordDetails(HttpServletRequest request, @RequestBody TestStudyRecordQuery testStudyRecordQuery) {

        log.info("VocabularyStudyRecordDetailsController queryOralConversationStudyRecordDetails ,参数:{}", testStudyRecordQuery);
        return oralConversationStudyRecordDetailsService.queryOralConversationStudyRecordDetails(testStudyRecordQuery);
    }
}
